home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / vidbasic.zip / VHELP.ASM < prev    next >
Assembly Source File  |  1990-11-29  |  4KB  |  118 lines

  1. ;«RM82»«TS8,16,24,32,40,48»
  2. ; 11/20/90
  3.  
  4. ;============================================================================
  5. ;   Copyright (C) Copr. 1990 by Sidney J. Kelly
  6. ;           All Rights Reserved.
  7. ;           Sidney J. Kelly
  8. ;           150 Woodhaven Drive
  9. ;           Pittsburgh, PA 15228
  10. ;           home phone 412-561-0950 (7pm to 9:30pm EST)
  11. ;============================================================================
  12.  
  13. DOSSEG
  14. .MODEL MEDIUM
  15.     PUBLIC BLOADHELP
  16.  
  17. .DATA
  18.     EXTRN   B$Seg:Word              ; name of DEF SEG storage register
  19.     EXTRN    B$DVIDEOSEG:WORD        ; video routines
  20.     EXTRN   B$DVIDEOPORT:WORD    ; retrace port address
  21.     EXTRN   B$DVIDEOINSTL:BYTE    ; test if we have defined display
  22.  
  23. .CODE
  24.     INCLUDE NOWAIT.INC
  25.     EXTRN    Get_Adapter:FAR
  26.     EXTRN   B$BLOD:FAR        ; QBASIC BLOAD routine
  27.  
  28. EVEN
  29. Org_DEFSEG    DW    0        ; original DEFSEG value
  30.  
  31. msr_values      db 2ch,28h,2dh,29h    ; reprogram CGA values
  32.         db 2AH,2eh,1eh,29h      ; when turn CGA back on
  33.  
  34. ;============================================================================
  35. ; DECLARE SUB BLOADHELP (FileName$)
  36. ; CALL BLOADHELP(FileName$)
  37. ;
  38. ; Purpose:
  39. ;         to BLOAD helpfiles without defining size of helpfile or type of
  40. ;         display, DEFSEG location, or anything else
  41. ;
  42. ; Assumes:
  43. ;         Both BSAVED file and CRT is setup for SCREEN 0, 80 * 25
  44. ;         Routine does not provide any critical error support.
  45. ;         Minor errors will cause abort unless ON ERROR GOTO support
  46. ;         is provided to handle common errors.
  47. ;
  48. ;         FileName$ must be a near string in DGROUP, cannot be FIXED Length
  49. ;         or TYPE'd.
  50. ;============================================================================
  51.  
  52. EVEN
  53. BLOADHELP PROC    FAR
  54.     Push    BP
  55.     Mov    BP,SP
  56.     Push    SI
  57.     Push    DI
  58.     CLD
  59.     Mov     AX,B$Seg                ; get original DEFSEG value
  60.     Mov     CS:[Org_DEFSEG],AX      ; store it
  61.     Cmp     B$DVIDEOINSTL,1         ; See if we have done this before
  62.     JE      Didit                   ; yep, so skip ahead
  63.     Call    Get_Adapter             ; call routine to find display type
  64.  
  65. Didit:
  66.     Mov     AX,B$DVIDEOSEG          ; store Video seg in DEFSEG
  67.     Mov     B$Seg,AX
  68.     Cmp     B$DVIDEOPORT,0          ; is it a snowy CGA?
  69.     JE      Begin                   ; nope, so do the hard work
  70.  
  71. CGA_Off:
  72.     Mov     DX,B$DVIDEOPORT         ; load address of CGA retrace port
  73.     CLI                             ; prevent interrupts to speed routine
  74.     Wait_CGA_Retrace                ; wait for CGA retrace MACRO
  75.     Mov     DX,03D8h                ; turn CGA off Mode control register
  76.     Mov     AL,00000001b            ; bit 3 = 0 to turn off display
  77.     Out     DX,AL
  78.     STI                             ; turn interrupts back on
  79.  
  80. Begin:
  81.     Mov     BX,[BP+6]               ; get string descripter address
  82.     Mov     DX,BX                   ; store temporarily in DX
  83.     Mov     CX,[BX]                 ; see if length of string = 0
  84.     JCXZ    Err_Out                 ; if zero, quit, don't BLOAD
  85.                     ; (you will just get an error so why
  86.                     ;   bother)
  87.     Push    DX                      ; push address of string descripter
  88.     Xor     AX,AX                   ; push 2 other parameters
  89.     Push    AX                      ; push 0 offset
  90.     Push    AX                      ; push 0 (ditto?) (not sure what this
  91.                     ; is for)
  92.     Call    B$BLOD                  ; call B$BLOD routine
  93.  
  94. Err_Out:
  95.     Cmp     B$DVIDEOPORT,0          ; is it a snowy CGA?
  96.     JE      Finis                   ; nope, no need to turn CGA on
  97.  
  98. CGA_On:                                 ; else is snowy CGA
  99.     CLI                             ; prevent interrupts to speed routine
  100.     Mov     DX,03D8h                ; load CRT Mode control register
  101.     Mov     AH,0Fh                  ; get current video mode
  102.     Int     10h                     ;
  103.     LEA     BX,msr_values           ; Point BX to msr_values table
  104.     Xlat    msr_values              ; load table value depending on
  105.                     ; current CGA vid mode in AL
  106.     Out     DX,AL                   ; do it
  107.     STI                             ; turn interrupts back on
  108.  
  109. Finis:
  110.     Mov     AX,CS:[Org_DEFSEG]      ; restore DEFSEG
  111.     Mov     B$Seg,AX                ; quit
  112.     Pop     DI                      ; restore registers used
  113.     Pop    SI
  114.     Pop    BP
  115.     Ret     2                       ; remove 1 (* 2) parameter from stack
  116. BLOADHELP ENDP
  117. END
  118.